home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / warpcom.zip / TERM.C < prev    next >
C/C++ Source or Header  |  1991-01-25  |  1KB  |  37 lines

  1. #include <conio.h>
  2. #include <stdio.h>
  3. #include <process.h>
  4. #include "warpcomm.h"
  5.  
  6. int main (void)
  7. {
  8.     char ch = 0, ch2 = 0;
  9.  
  10.     clrscr ();
  11.     cputs (
  12. "A simple terminal program to demonstrate the Warp-Comm library (Ctrl-C to Exit)\r\n\n"
  13.         );
  14.     com_open (2400, 4, 0x3F8, 2000, 2000);
  15.     /* opens the com port at 2400 baud, IRQ 4, base address 3F8 (hex) with
  16.      2000 byte transmit and receive buffers */
  17.  
  18.     send_modem_string ("ATZ|");
  19.     /* initializes the modem */
  20.  
  21.  
  22.     while (ch != 3) {
  23.         if (kbhit ()) {            /* check the keyboard for a keypress */
  24.             ch = getch ();         /* get the keypress */
  25.             com_out_char (ch);     /* send the keypress to the modem */
  26.         }
  27.         if (char_waiting ()) {
  28.             /* check to see if the modem has a character waiting */
  29.  
  30.             ch2 = com_get_char (); /* get the character from the com port */
  31.             putch (ch2);           /* print the character on the screen */
  32.         }
  33.     }
  34.     com_close ();                  /* close the com port */
  35.     exit (0);                      /* exit with errorlevel 0 */
  36. }
  37.